home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
mquery
/
mprofile.frm
< prev
next >
Wrap
Text File
|
1995-05-02
|
11KB
|
448 lines
VERSION 2.00
Begin Form fStoreQry
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Stored Query Manager"
ClientHeight = 3960
ClientLeft = 1290
ClientTop = 2685
ClientWidth = 4980
ClipControls = 0 'False
ControlBox = 0 'False
Height = 4365
Left = 1230
LinkMode = 1 'Source
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3960
ScaleWidth = 4980
Top = 2340
Width = 5100
Begin OptionButton OpSQLUser
BackColor = &H00C0C0C0&
Caption = "Public:"
Height = 240
Index = 1
Left = 465
TabIndex = 7
Top = 2250
Width = 885
End
Begin OptionButton OpSQLUser
BackColor = &H00C0C0C0&
Caption = "Private:"
Height = 240
Index = 0
Left = 465
TabIndex = 13
Top = 1950
Value = -1 'True
Width = 915
End
Begin CommandButton DeleteBtn
Cancel = -1 'True
Caption = "&Delete"
Height = 375
Left = 3735
TabIndex = 12
Top = 3060
Width = 1035
End
Begin SSPanel msgpanel
Align = 2 'Align Bottom
BackColor = &H00C0C0C0&
BevelInner = 1 'Inset
Font3D = 0 'None
ForeColor = &H00FF0000&
Height = 420
Left = 0
TabIndex = 6
Top = 3540
Width = 4980
End
Begin ListBox cqueries
BackColor = &H00C0C0C0&
ForeColor = &H00000000&
Height = 1005
Left = 570
Sorted = -1 'True
TabIndex = 11
TabStop = 0 'False
Top = 390
Width = 3855
End
Begin CommandButton BtnQuit
Caption = "&Quit"
Height = 375
Left = 2520
TabIndex = 5
Top = 3060
Width = 1035
End
Begin CommandButton BtnRead
Caption = "&Load"
Height = 375
Left = 1305
TabIndex = 4
Top = 3060
Width = 1035
End
Begin CommandButton BtnWrite
Caption = "&Save"
Height = 375
Left = 120
TabIndex = 3
Top = 3060
Width = 1035
End
Begin TextBox TxtKey
BackColor = &H00C0C0C0&
Height = 375
Left = 1500
TabIndex = 2
Top = 2520
Width = 2895
End
Begin TextBox TxtSection
BackColor = &H00C0C0C0&
Height = 375
Left = 1500
TabIndex = 1
TabStop = 0 'False
Top = 2040
Width = 2895
End
Begin TextBox TxtINIFile
BackColor = &H00C0C0C0&
Enabled = 0 'False
Height = 375
Left = 1500
TabIndex = 0
TabStop = 0 'False
Top = 1560
Width = 2895
End
Begin Label lblQueries
Alignment = 2 'Center
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Select Query"
Height = 195
Left = 540
TabIndex = 9
Top = 210
Width = 1125
End
Begin Label LblKey
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Query Name:"
Height = 195
Left = 285
TabIndex = 8
Top = 2640
Width = 1110
End
Begin Label LblINIFile
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Storage:"
Height = 195
Left = 690
TabIndex = 10
Top = 1620
Width = 735
End
End
Dim FwriteFlag As Integer ' did I write
Dim Fdelstr As String
Dim FSection As String
Dim fDefaultuser As String
Sub BtnQuit_Click ()
' written or quit
If FwriteFlag Then ' stored query
FwriteFlag = False
End If
gstDynaString = ""
' was this a stored query that was run
If Not gStoredFlag Then 'not from storage
fQuery!RunSaveQryButton.Enabled = True
fQuery!RunQueryButton.Enabled = False
If gfFROMSQL Then ' was a SQL Statement?
fQuery!RunQueryButton.Enabled = False
End If
Else
fQuery!RunSaveQryButton.Enabled = True
End If
Unload Me
End Sub
Sub BtnRead_Click ()
If TxtINIFile.Text = "" Then
Beep
TxtINIFile.SetFocus
Exit Sub
End If
If TxtSection.Text = "" Then
Beep
TxtSection.SetFocus
Exit Sub
End If
If Txtkey.Text = "" Then
Beep
Txtkey.SetFocus
Exit Sub
End If
'Assign textbox contents to variables for API call.
'(API call won't take references to Textbox contents.)
Sectn$ = TxtSection.Text
Keyy$ = Txtkey.Text
DeeFalt$ = ""
FileNam$ = gWindowsDirectory + "\" + TxtINIFile.Text
gstDynaString = StringfromPrivINI(Sectn$, Keyy$, DeeFalt$, FileNam$)
If gstDynaString = "" Then
msgpanel.Caption = "Section, Key or File name not found."
Else
fQuery!RunSaveQryButton.Enabled = False
DeleteBtn.Enabled = True
Unload Me
End If
End Sub
Sub BtnWrite_Click ()
FwriteFlag = False
DeleteBtn.Enabled = False
If TxtSection.Text = "" Then
Beep
TxtSection.SetFocus
Exit Sub
End If
If Txtkey.Text = "" Then
Beep
Txtkey.SetFocus
Exit Sub
End If
' clear out GstDynaString if it has carriage return and linefeeds
' pasted or otherwise inserted
a% = 0
For y% = 1 To Len(gstDynaString) - 2
a% = InStr(y% + a%, gstDynaString, Chr(13) + Chr(10))
If a% Then
gstDynaString = Left(gstDynaString, a% - 1) + " " + Mid(gstDynaString, a% + 2, Len(gstDynaString))
End If
Next y%
Sectn$ = TxtSection.Text
Keyy$ = Txtkey.Text
Valyue$ = gstDynaString
FileNam$ = gWindowsDirectory + "\" + TxtINIFile.Text
Result% = StringtoPrivINI(Sectn$, Keyy$, Valyue$, FileNam$)
If Result% = 0 Then
msgpanel.Caption = "QUERY NOT SAVED."
Else
msgpanel.Caption = "QUERY SAVED."
FwriteFlag = True
End If
gstDynaString = ""
End Sub
Sub cqueries_Click ()
If gstDynaString = "" Then
Txtkey.Text = cqueries.List(cqueries.ListIndex)
BtnRead.Enabled = True
DeleteBtn.Enabled = True
msgpanel.Caption = "QUERY SELECTED ...LOAD OR DELETE OR QUIT."
End If
End Sub
Sub cqueries_KeyPress (keyascii As Integer)
keyascii = 0
End Sub
Sub DeleteBtn_Click ()
Fdelstr = Txtkey.Text
If MsgBox("Delete " & Fdelstr & " ?", MSGBOX_TYPE) = YES Then
delquery
Unload Me
End If
End Sub
Sub delquery ()
Dim f As String
Dim h As String
Dim a As Integer
Dim b As Integer
Dim filein As String
Dim fileout As String
On Error GoTo errorhere
a = InStr(1, TxtINIFile.Text, ".")
f